﻿using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;

namespace Little.Soldier.Licensing
{
  [ToolboxItem(false)]
  [DesignTimeVisible(false)]
  internal class RuntimeGetFreeKeyForm : Form
  {
    private Timer tmeCountDown = new Timer();
    private int intTry = 3;
    private Button btnGetKey = new Button();
    private Button btnOK = new Button();
    private bool isValid;
    private IContainer container1;
    private Label label2;
    internal Label label1;
    private Panel panel2;
    internal Label label3;
    private Label label4;
    internal Label lblVersion;

    public RuntimeGetFreeKeyForm()
    {
        this.InitializeComponent();
    }

    protected override void OnLoad(EventArgs e)
    {
      base.OnLoad(e);
      if (this.DesignMode)
        return;
      this.btnOK.Text = "(" + this.intTry.ToString() + ")";
      this.btnOK.Refresh();
      this.tmeCountDown.Interval = 1000;
      this.tmeCountDown.Tick += new EventHandler(this.tmeCountDown_Tick);
      this.tmeCountDown.Enabled = true;
    }

    private void tmeCountDown_Tick(object sender, EventArgs e)
    {
      if (this.isValid)
        return;
      if (this.intTry > 1)
      {
        --this.intTry;
        this.btnOK.Text = "(" + this.intTry.ToString() + ")";
      }
      else
        goto label_5;
label_3:
      this.btnOK.Refresh();
      return;
label_5:
      this.isValid = true;
      this.tmeCountDown.Enabled = false;
      this.btnOK.Text = "OK";
      this.btnOK.Enabled = true;
      goto label_3;
    }

    private void btnGetKey_Click(object sender, EventArgs e)
    {
      Process.Start("http://www.littlesoldier.com/links/get_free_trial_key.aspx");
      this.Close();
    }

    private void btnOK_Click(object sender, EventArgs e)
    {
      this.Close();
    }

    protected override void OnClosing(CancelEventArgs e)
    {
      e.Cancel = !this.isValid;
      base.OnClosing(e);
    }

    protected override void Dispose(bool disposing)
    {
        if (disposing && this.container1 != null)
        goto label_2;
label_1:
      base.Dispose(disposing);
      return;
label_2:
      this.container1.Dispose();
      goto label_1;
    }

    private void InitializeComponent()
    {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RuntimeGetFreeKeyForm));
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.btnGetKey = new System.Windows.Forms.Button();
            this.btnOK = new System.Windows.Forms.Button();
            this.panel2 = new System.Windows.Forms.Panel();
            this.label4 = new System.Windows.Forms.Label();
            this.lblVersion = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.panel2.SuspendLayout();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.BackColor = System.Drawing.Color.Transparent;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
            this.label1.Location = new System.Drawing.Point(157, 65);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(254, 41);
            this.label1.TabIndex = 1;
            this.label1.Text = "This is a 14 day trial version.";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.BackColor = System.Drawing.Color.Transparent;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
            this.label2.Location = new System.Drawing.Point(156, 248);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(103, 13);
            this.label2.TabIndex = 2;
            this.label2.Text = "All Rights Reserved.";
            // 
            // btnGetKey
            // 
            this.btnGetKey.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnGetKey.Location = new System.Drawing.Point(320, 208);
            this.btnGetKey.Name = "btnGetKey";
            this.btnGetKey.Size = new System.Drawing.Size(117, 22);
            this.btnGetKey.TabIndex = 0;
            this.btnGetKey.Text = "Get Free Trial Key";
            this.btnGetKey.Visible = false;
            this.btnGetKey.Click += new System.EventHandler(this.btnGetKey_Click);
            // 
            // btnOK
            // 
            this.btnOK.Cursor = System.Windows.Forms.Cursors.Default;
            this.btnOK.Enabled = false;
            this.btnOK.Location = new System.Drawing.Point(362, 241);
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new System.Drawing.Size(75, 23);
            this.btnOK.TabIndex = 3;
            this.btnOK.Text = "OK";
            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
            // 
            // panel2
            // 
            this.panel2.BackColor = System.Drawing.Color.Transparent;
            this.panel2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel2.BackgroundImage")));
            this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panel2.Controls.Add(this.label4);
            this.panel2.Controls.Add(this.lblVersion);
            this.panel2.Controls.Add(this.label3);
            this.panel2.Controls.Add(this.btnGetKey);
            this.panel2.Controls.Add(this.label1);
            this.panel2.Controls.Add(this.label2);
            this.panel2.Location = new System.Drawing.Point(0, 0);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(449, 275);
            this.panel2.TabIndex = 26;
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.BackColor = System.Drawing.Color.Transparent;
            this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
            this.label4.Location = new System.Drawing.Point(156, 232);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(178, 13);
            this.label4.TabIndex = 5;
            this.label4.Text = "Copyright © 2014 Little Soldier .NET";
            // 
            // lblVersion
            // 
            this.lblVersion.BackColor = System.Drawing.Color.Transparent;
            this.lblVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
            this.lblVersion.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(218)))), ((int)(((byte)(41)))), ((int)(((byte)(42)))));
            this.lblVersion.Location = new System.Drawing.Point(157, 40);
            this.lblVersion.Name = "lblVersion";
            this.lblVersion.Size = new System.Drawing.Size(254, 14);
            this.lblVersion.TabIndex = 4;
            this.lblVersion.Text = "Version 2012.1";
            // 
            // label3
            // 
            this.label3.BackColor = System.Drawing.Color.Transparent;
            this.label3.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
            this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(218)))), ((int)(((byte)(41)))), ((int)(((byte)(42)))));
            this.label3.Location = new System.Drawing.Point(156, 18);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(267, 22);
            this.label3.TabIndex = 3;
            this.label3.Text = "Little Soldier .NET";
            // 
            // RuntimeGetFreeKeyForm
            // 
            this.BackColor = System.Drawing.Color.White;
            this.ClientSize = new System.Drawing.Size(449, 275);
            this.ControlBox = false;
            this.Controls.Add(this.btnOK);
            this.Controls.Add(this.panel2);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "RuntimeGetFreeKeyForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Little Soldier .NET not licenced";
            this.TopMost = true;
            this.panel2.ResumeLayout(false);
            this.panel2.PerformLayout();
            this.ResumeLayout(false);

    }
  }
}
